<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>清除浮动</title>
</head>
<body>
<style>
    #div1{
        width: 200px;
        height: 200px;
        background: red;
        float: right;
        /*只影响使用清除的元素本身，不影响其他元素*/
        /*clear: left; !*没效果*!*/
    }
    #div2{
        width: 200px;
        height: 200px;
        background: yellow;
        float: right;
        /*clear: right; !*效果*!*/

    }
    #div3{
        width: 200px;
        height: 200px;
        background: blue;
        float: right;
    }
    #div4{
        width: 200px;
        height: 200px;
        background: green;
    }
</style>
<div id="div1">
</div>
<div id="div2">
</div>
<div id="div3">
</div>
<div id="div4">
</div>
</body>
</html>